import React from 'react';
import { inject, observer } from 'mobx-react';
import { Button } from "antd";

import { WeaLocaleProvider, WeaDialog} from 'ecCom';

import {Condition} from '../list/listCondition';
import {Text} from '../util/text';
const text = new Text();
const getLabel = WeaLocaleProvider.getLabel;

@observer
class InfoFeedbackDialog extends React.Component {
    
    render() {
        //根据type判断使用调用场景
        //type=0 信息反馈list中点击标题弹出该dialog查看信息
        //type=1 上报信息中审批驳回弹出该dialog填写反馈信息
        //type=2 信息处理中可以进行信息反馈
        const { type,store,store:{status,setState,feedbackForm,feedbackCondition,submitInfoFeedback} } = this.props;
        const {visible} = status;
        let button = [];
        if(type != '0') {
            button.push((<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@o1yvwx@submitInfoFeedback`} type="primary"  onClick={() => submitInfoFeedback({type:type}) }>{text.SURE}</Button>));
        }
        button.push((<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@k09nc6@CANCEL`} type="ghost" onClick ={() => setState({ visible: false }) }>{text.CANCEL}</Button>));
        return (
            <div>
                <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@zyw1el`}
                    icon="icon-coms-government"
                    iconBgcolor='#f14a2d'
                    title={text.FEEDBACKINFO}
                    visible={visible}
                    style={{ width: 500, height: 400 }}
                    onCancel={() => setState({ visible: false }) }
                    buttons={button}
                    >
                    <Condition ecId={`${this && this.props && this.props.ecId || ''}_Condition@cn7w8c`} form={feedbackForm} condition={feedbackCondition} col={1} underline={type == '0' ? true : false}></Condition>
                </WeaDialog>
            </div>
        )
    }

}

export {InfoFeedbackDialog};